package cn.tedu.egmybatis2.mapper;

import cn.tedu.egmybatis2.pojo.entity.Orders;
import cn.tedu.egmybatis2.pojo.vo.OrdersVo1;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface OrdersMapper {
    @Insert("INSERT INTO orders (status,amount,created) VALUES (#{status},#{amount},#{created})")
    int insertOrders(Orders orders);

    @Select("SELECT id,status,amount,created FROM orders")
    List<Orders> selectAll();

    @Select("SELECT status,amount FROM orders WHERE id=#{id}")
    OrdersVo1 selectOne(int id);

    @Insert("INSERT INTO orders (status,amount,created) VALUES (#{status},#{amount},#{created})")
     int insertOrders2(Orders orders);

    @Delete("DELETE FROM orders WHERE id=#{id}")
    int deleteById(int id);
}
